//
//  threeImageTableViewCell.m
//  SeseNews
//
//  Created by lanou3g on 15/7/22.
//  Copyright (c) 2015年 Sese工作室. All rights reserved.
//
#define width 375
#define height 667
#import "threeImageTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation threeImageTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //布局cell
        self.titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(8, 8, 0.85*width,0.2*0.224*height)];
        self.titleLabel.font=[UIFont systemFontOfSize:18];
        [self addSubview:self.titleLabel];
        self.image1=[[UIImageView alloc]initWithFrame:CGRectMake(8, 48, 0.3*width, 0.54*0.224*height)];
        [self addSubview:self.image1];
        self.image2=[[UIImageView alloc]initWithFrame:CGRectMake(131, 48, 0.3*width, 0.54*0.224*height)];
        [self addSubview:self.image2];
        self.image3=[[UIImageView alloc]initWithFrame:CGRectMake(254, 48,0.3*width, 0.54*0.224*height)];
        [self addSubview:self.image3];
        self.commentsall=[[UILabel alloc]initWithFrame:CGRectMake(280,126, 0.11*width, 0.17*0.224*height)];
        self.commentsall.textAlignment=NSTextAlignmentRight;
        [self addSubview:self.commentsall];
        
        self.commentsLaebl=[[UILabel alloc]initWithFrame:CGRectMake(335, 128,35,0.15*0.21*height)];
        self.commentsLaebl.text = @"跟帖";
        [self addSubview:self.commentsLaebl];
        
    }
    return self;
}

-(void)setCellThreeModel:(model *)cellThreeModel{
    _cellThreeModel=cellThreeModel;
    //使用第三方异步下载图片
    [self.image1 sd_setImageWithURL:[NSURL URLWithString:self.cellThreeModel.imageUrl1]];
    [self.image2 sd_setImageWithURL:[NSURL URLWithString:self.cellThreeModel.imageUrl2]];
    [self.image3 sd_setImageWithURL:[NSURL URLWithString:self.cellThreeModel.imageUrl3]];
    self.titleLabel.text=self.cellThreeModel.title;
    //判断评论是否过万
    CGFloat count=[self.cellThreeModel.commentsall intValue];
    NSString *disPlayCount;
    if (count>10000) {
        disPlayCount=[NSString stringWithFormat:@"%.1f万",count/10000];
    }else{
        disPlayCount=[NSString stringWithFormat:@"%.f",count];
    }
    if ([disPlayCount isEqualToString:@"0"]) {
        disPlayCount=nil;
    }
    self.commentsall.text=disPlayCount;
}













- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
